package com;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

/**
 * Created by liuhaibin on 2017/6/20.
 */
public class Consumer implements ChannelAwareMessageListener{
//    public void onMessage(Message message) {
//        try {
//            System.out.println("============================1231231");
////            System.out.println(new String(message.getBody(), "UTF-8"));
//            System.out.println(message.toString());
//
//        }catch (Exception e){
//
//        }
//
//    }

    @Override
    public void onMessage(Message message, Channel channel) throws Exception {
        System.out.println("============================1231231");
        System.out.println(new String(message.getBody(), "UTF-8"));
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
